function wordCount(source,target,maxCharecter){
    source.keyup(function(e)//Detect keypress in the textarea
    {
        var text_area_box =$(this).val();//Get the values in the textarea
        var max_numb_of_words = maxCharecter;//Set the Maximum Number of words
        //var main = text_area_box.length*100;//Multiply the lenght on words x 100
        //var value= (main / max_numb_of_words);//Divide it by the Max numb of words previously declared
        // var count= (max_numb_of_words - text_area_box.length)+'/'+maxCharecter;//Get Count of remaining characters
        
        
        
        
        var newlines = text_area_box.match(/\n/g);
        var countNewline = newlines == null ? 0 :  newlines.length;
        var strLength = text_area_box.length + countNewline;
        //done by brijesh
        //        if(e.which == 13 && strLength>=249) {
        //            source.val(text_area_box.substr(0,max_numb_of_words-1));
        //        }else{
            
        
        
        var displayCountStr = (strLength)+'/'+maxCharecter;//Get Count of remaining characters
        
        if(strLength <= max_numb_of_words)
        {
            target.html(displayCountStr);//Output the count variable previously calculated into the div with id= count
             
        }
        else
        {
            source.val(text_area_box.substr(0,max_numb_of_words));//Remove the excess words using substring

        }
        //}
        return false;
    });

}
function wordCountOnPageLoad(source,target,maxCharecter){
  
    var text_area_box =source.val();//Get the values in the textarea
    var newlines = text_area_box.match(/\n/g);
    var countNewline = newlines == null ? 0 :  newlines.length;
        
    var strLength = text_area_box.length + countNewline;
    var displayCountStr = (strLength)+'/'+maxCharecter;//Get Count of remaining characters
           
    target.html(displayCountStr);//Output the count variable previously calculated into the div with id= count
   
}

var $body = $(this.ie6 ? document.body : document);

Whywait = {
    
    
    loader : function(flag) {
      
        var w=$body.width();
        var h=$body.height();
        if (!flag) {
            jQuery('#progressbar').hide().remove();
        } else {
            var div = jQuery('<div>', {
                'id' : 'progressbar',
                'class' : 'loading',
                'style' : 'width:'+w+'px;'+'height:'+h+'px'
            });
            div.show();
            $('body').append(div);

        }

    }

        
        
}